﻿using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Resources;
using System.Windows.Shapes;

namespace DanielVaughan.Sokoban.UI
{
	public class SokobanService : ISokobanService
	{
		public int LevelCount
		{
			get
			{
				return 50;
			}
		}

		public string GetMap(int levelNumber)
		{
			var map = ReadStringFromResource(string.Format("/Levels/Level{0:000}.skbn", levelNumber));
			return map;
		}

		string ReadStringFromResource(string streamName)
		{
			string path = "/DanielVaughan.Sokoban.UI;component/" + streamName;
			Uri uri = new Uri(path, UriKind.Relative);
			StreamResourceInfo sri = Application.GetResourceStream(uri);
			using (TextReader reader = new  StreamReader(sri.Stream))
            {
            	return reader.ReadToEnd();
            }
		}
	}
}
